<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>数的升序排序</title>

    <script>
    var arr = [5,67,343,672,43,9,44,34];
    let newArr = arr.sort(function (a, b) {
        return a - b;
    })
 console.log(newArr);
    </script>

            
        <!--<script>
            var arr = [5,67,343,672,43,9,44,34];
            function mySort(arr)
            {
                for(var i=0;i<=arr.lenght-1;i++)
                {
                    for(var k=1;k<=arr.lenght-1-i;k++)
                    {
                        if(arr[k]>arr[k+1])
                        {
                            var temp=arr[k];
                            arr[k]=arr[k+1];
                            arr[k+1]=temp;
                        }
                    }
                }
                return arr;
            }
            console.log(mySort(arr));
        </script>-->
    

    </head>
    <body>
        <script type="">
            document.write(arr);
        </script>
    </body>
</html>